{% extends 'admin/_layout.html' %}

{% block body %}
<div class="row">
    <div class="col-12 grid-margin stretch-card">
        <div class="card">
            <div class="row">
                <div class="col-md-4">
                    <div class="card-body">
                        <a href="{{request.args.get('back')}}" class="btn btn-info">返回</a>
                    </div>
                </div>
                <div class="col-md-8">
                    <div class="card-body">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-12 grid-margin stretch-card">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">任务管理</h4>
                <p class="card-description">
                    任务管理 /<code>任务分组</code>
                </p>
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            {% for t in cfg %}
                            <th>{{t['label']}}</th>
                            {% endfor %}
                            <th>管理</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for row in data %}
                        <tr>
                            {% for item in cfg %}
                            <td>
                                {{row[item['field']]}}
                            </td>
                            {% endfor %}
                            <td>
                                <button onclick="showDetail({{row['id']}})" class="btn btn-inverse-info btn-fw">查看详情</button>
                            </td>
                        </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="js/sweetalert2.min.js"></script>
<script src="vendors/js/SwalAide.js"></script>
<script src="js/jquery.min.js"></script>
<script>
    function showDetail(id){
        $.get('/show_log_detail',{id:id},
            function (rsp) {
                SwalAide.showHtml('日志详情',rsp.data);
            }, 'json');
    }
</script>
{% endblock %}